package com.farsunset.lvxin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket apiDucket(ApiInfo apiInfo) {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo)
                .groupName("开放接口")
                .select()
                //为当前包路径
                .apis(RequestHandlerSelectors.basePackage("com.farsunset.lvxin.mvc.controller.api"))
                .build();
    }




    @Bean
    public ApiInfo apiInfo() {
        Contact contact = new Contact("远方夕阳","3979434@qq.com","http://farsunset.com");
        return new ApiInfoBuilder()
                .title("Risk Control APIs Service")
                .description("侣信推送系统接口")
                .contact(contact)
                .version("2.0")
                .build();
    }

}
